package cn.fay.chapter14;

import java.util.ArrayList;
import java.util.List;

public class ForNameCreator extends PetCreator {

	private static List<Class<? extends Pet>> types=new ArrayList<Class<? extends Pet>>();
	private static String[] typeNames={
		"cn.fay.chapter14.Mutt",
		"cn.fay.chapter14.Pug",
		"cn.fay.chapter14.EgyptianMau",
		"cn.fay.chapter14.Manx",
		"cn.fay.chapter14.Cymric",
		"cn.fay.chapter14.Rat",
		"cn.fay.chapter14.Mouse",
		"cn.fay.chapter14.Hamster"
	};
	private static void loader(){
		try {
			for (String name : typeNames) {
				types.add((Class<? extends Pet>)Class.forName(name));
			}
		} catch (ClassNotFoundException e) {
			throw new RuntimeException(e.getMessage(),e);
		}
	}
	static {loader();}
	@Override
	public List<Class<? extends Pet>> types() {
		
		return types;
	}

}
